home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / fbr12c / rwassoc.frm < prev   
Text File  |  1995-09-06  |  4KB  |  133 lines

  1. VERSION 2.00
  2. Begin Form RWAssoc 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   1  'Fixed Single
  5.    Caption         =   "Associate"
  6.    ClientHeight    =   1185
  7.    ClientLeft      =   1335
  8.    ClientTop       =   1905
  9.    ClientWidth     =   6675
  10.    ControlBox      =   0   'False
  11.    Height          =   1590
  12.    Left            =   1275
  13.    LinkMode        =   1  'Source
  14.    LinkTopic       =   "Form1"
  15.    MaxButton       =   0   'False
  16.    MinButton       =   0   'False
  17.    ScaleHeight     =   1185
  18.    ScaleWidth      =   6675
  19.    Top             =   1560
  20.    Width           =   6795
  21.    Begin TextBox AssProg 
  22.       Height          =   300
  23.       Left            =   1605
  24.       TabIndex        =   2
  25.       Top             =   690
  26.       Width           =   4875
  27.    End
  28.    Begin CommandButton Ass 
  29.       Caption         =   "&Exit"
  30.       Height          =   345
  31.       Index           =   3
  32.       Left            =   5280
  33.       TabIndex        =   4
  34.       Top             =   195
  35.       Width           =   1200
  36.    End
  37.    Begin CommandButton Ass 
  38.       Caption         =   "Ass&ociate"
  39.       Height          =   345
  40.       Index           =   2
  41.       Left            =   3765
  42.       TabIndex        =   3
  43.       Top             =   195
  44.       Width           =   1200
  45.    End
  46.    Begin CommandButton Ass 
  47.       Caption         =   "&View"
  48.       Height          =   345
  49.       Index           =   1
  50.       Left            =   2205
  51.       TabIndex        =   1
  52.       Top             =   195
  53.       Width           =   1200
  54.    End
  55.    Begin TextBox Extension 
  56.       Height          =   300
  57.       Left            =   1155
  58.       TabIndex        =   0
  59.       Top             =   225
  60.       Width           =   615
  61.    End
  62. End
  63. DefInt A-Z
  64.  
  65. Sub Ass_Click (Index As Integer)
  66.     NL$ = Chr$(13) + Chr$(10)
  67.     Msg$ = "You must enter an extension first."
  68.     Select Case Index
  69.         Case 1
  70.             Ext$ = LTrim$(RTrim$(Extension.Text))
  71.             If Len(Ext$) Then
  72.                 Prog$ = LTrim$(RTrim$(GetWinStr("extensions", Ext$, "Not Associated")))
  73.                 If Prog$ <> "Not Associated" Then
  74.                     Pos = InStr(1, Prog$, Chr$(32))
  75.                     Prog$ = Left$(Prog$, Pos - 1)
  76.                 End If
  77.                 AssProg.Text = Prog$
  78.             Else
  79.                 MsgBox Msg$, 48, "View Association"
  80.             End If
  81.         Case 2
  82.             Tit$ = "Associate"
  83.             Ext$ = LTrim$(RTrim$(Extension.Text))
  84.             Prog$ = LTrim$(RTrim$(AssProg.Text))
  85.             If Len(Ext$) Then
  86.                 If Len(Prog$) Then Prog$ = Prog$ + Chr$(32) + "^." + Ext$
  87.                 z = PutWinINI("extensions", Ext$, Prog$)
  88.                 If Not z Then
  89.                     MsgBox "Association failure.", 48, Tit$
  90.                 Else
  91.                     AssProg.Text = "Success: " + UCase$(Prog$)
  92.                 End If
  93.             Else
  94.                 MsgBox Msg$, 48, Tit$
  95.             End If
  96.         Case 3
  97.             Unload RWAssoc
  98.     End Select
  99. End Sub
  100.  
  101. Sub AssProg_KeyPress (KeyAscii As Integer)
  102.     If KeyAscii = (32) Then
  103.         KeyAscii = 0
  104.         Beep
  105.         Beep
  106.     End If
  107. End Sub
  108.  
  109. Sub Extension_KeyPress (KeyAscii As Integer)
  110.     If KeyAscii = 46 Then
  111.         KeyAscii = 0
  112.         Beep
  113.         Beep
  114.     End If
  115. End Sub
  116.  
  117. Sub Form_Load ()
  118.     RWAssoc.Left = FBRunWay.Left
  119.     RWAssoc.Top = FBRunWay.Top + FBRunWay.Height
  120. End Sub
  121.  
  122. Sub Form_Paint ()
  123.     FrameFrm RWAssoc
  124.     FrameCtrl RWAssoc, Extension, Extension, Extension, Extension
  125.     For x = 1 To 3
  126.         FrameCtrl RWAssoc, Ass(x), Ass(x), Ass(x), Ass(x)
  127.     Next x
  128.     FrameCtrl RWAssoc, AssProg, AssProg, AssProg, AssProg
  129.     LeftLabel "Extension:", RWAssoc, Extension
  130.     LeftLabel "Associate With:", RWAssoc, AssProg
  131. End Sub
  132.  
  133.